#!/usr/bin/python

import logging.config
import configparser


def init_logger(log_config, log_name):
    logging.config.fileConfig(log_config)
    logger = logging.getLogger(log_name)
    if logger is None:
        return None
    logger.info('init_logger ok')
    return logger


def init_config(config_file):
    config = configparser.ConfigParser()
    if config.read(config_file, encoding="utf-8-sig"):
        return config
    return None
